import collections


class Solution(object):
    def canDivideIntoSubsequences(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: bool
        """
        d = collections.Counter(nums)
        count = max(d.values())
        n = len(nums)
        if count * k <= n:
            return True
        else:
            return False


data = Solution()
nums = [1, 2, 2, 3, 3, 4, 4]
k = 3
print(data.canDivideIntoSubsequences(nums, k))
nums = [5, 6, 6, 7, 8]
k = 2
print(data.canDivideIntoSubsequences(nums, k))
